
class NWCalculator(object):
    """
    An independent honor lister class (because separation of application
    and protocol logic is a good thing).
    """
    triggers = ["!nw"]
    prefix = "http://u1.swirve.com/players/honor-"
    postfix = ".htm"

    name = "networth"
    help = ["Networth calculation:",
            "%c6!nw%c <your-nw>"%(03,03)]
    
    def command(self, firstword, user, channel, msg):
        parts = msg.split()
        try:
            nw = float(parts[1])
        except:
            return {'chanmsg': ["Usage: %c6!nw%c <your-nw>"%(03,03)]}

        lower = round(nw*0.85)
        upper = round(nw*1.20)
        return {'chanmsg': ["Your max gains range is%c4 %d%c -%c4 %d%c."%(03,lower,03,03,upper,03)]}